package com.spzx.user.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.user.api.domain.UpdateUserLogin;
import com.spzx.user.api.domain.UserInfo;
import com.spzx.user.api.fallback.UserInfoFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName UserInfoFeignClient
 * @Author 波
 * @Date 2024/8/9 20:18
 */
@FeignClient(contextId = "userInfoFeignClient", path = "/userInfo", value = ServiceNameConstants.USER_SERVICE, fallbackFactory = UserInfoFeignClientFallbackFactory.class)
public interface UserInfoFeignClient {
    @PostMapping("/register")
    R<Boolean> register(@RequestBody UserInfo userInfo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PutMapping("/updateUserLogin")
    R<Boolean> updateUserLogin(@RequestBody UpdateUserLogin updateUserLogin, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/info/{username}")
     R<UserInfo> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
